import 'package:flutter/material.dart';
import 'package:x3_base_package/x3_base_package.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html/style.dart';

class BusinessDepotStyleDetailsFABTab extends StatelessWidget {
  BusinessDepotStyleDetailsFABTab({Key key, @required this.styleId}) : super(key: key);

  final String styleId;

  @override
  Widget build(BuildContext context) {
    return BaseCardComponent(
      child: BaseScreenRefreshComponent(
        request: new BaseScreenRequestModel('/bi/report/app/query/query/style/fab/json/{styleId}', params: { 'styleId': styleId }, method: BaseHttpMethodEnum.GET),
        builder: ( BaseHttpResultModel result ) {
          String value = BaseUtils.getKeyData(result.data, 'value').toString();
          return value.length == 0 ? Center(child: Text('暂无FAB')) : _buildAnnouncementContentHtmlWidget( value );
        },
      ),
    );
  }

  Widget _buildAnnouncementContentHtmlWidget( String value ) {
    Style _style = Style(letterSpacing: 1, fontSize: FontSize.large);
    return Html(data: value, style: {"div": _style, "p": _style});
  }
}
